package response

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

type JsonResponseStruct struct {
	Code    int         `json:"code"`
	Message interface{}      `json:"message"`
	Result  interface{} `json:"result"`
}

const SuccessCode = 22000      //成功
const FailCode = 22001         //失败
const LogOutCode = 22002       //已退出
const NoPermissionCode = 22003 //无权限

func JsonResponse(c *gin.Context, code int, data interface{}, message interface{}) {
	c.JSON(http.StatusOK, &JsonResponseStruct{
		Code:    code,
		Message: message,
		Result:  data,
	})
}
